package com.photoprint.db;
import android.content.ContentResolver;
import android.content.Context;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.net.Uri;

public class DBHelper extends SQLiteOpenHelper {

//	public static final String DATABASE_NAME = "im.db";
	public static final int DATABASE_VERSION = 2;
	private DBDefine mDBDefine = null;
	private ContentResolver mContentResolver;
	
	public DBHelper(Context context,String db) {
		super(context, db, null, DATABASE_VERSION);
		mDBDefine = new DBDefine();
		mContentResolver = context.getContentResolver();
	}

	
	public void onCreate(SQLiteDatabase db) {
		try {
			//TODO SLQ 
			db.execSQL(mDBDefine.creatSHOPCARTableSql());
			db.execSQL(mDBDefine.creatADDRESSTableSql());
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

	
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		onCreate(db);
	}
	
	//cj
	public void sendNotify(Uri uri) {
			mContentResolver.notifyChange(uri, null);		
	}

}
